<%@ page import="utils.PageUtils" %>
<%@ page import="model.StudentClass" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="model.Student" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: 86189
  Date: 2023/5/22
  Time: 10:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>
<!DOCTYPE html >
<html>
<head>
    <meta charset="UTF-8">
    <title>分页</title>
    <style type="text/css">
        a{
            margin:15px 0;
            display: inline-block;
            width:60px;
            height:30px;
            background-color: #f6f6f6;
            text-align: center;
            line-height: 30px;
            text-decoration: none;
        }
        .class-search{
            width:600px;
            margin:0 auto;
        }
        .class-list{
            width:455px;
            margin:0 auto;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="class-search">
    <!--JSP中取得绝对路径-->
    <%
        pageContext.getRequest().getServletContext().getContextPath();
    %>
    <form method="get" action="${pageContext.request.contextPath }/classList">
       <!-- 班级名称：<input type="text" name="class_type" value="${classType}">&emsp;
        所属院系：<input type="text" name="dno_name" value="${dnoName }">&emsp;
        <input type="submit" value="查询" >-->
    </form>
</div>

<div class="class-list">

    <table border="1">
        <caption><H3>班级信息</H3></caption>
        <tr><th>班级编号</th><th>班级名称</th><th>所属院系</th></tr>
        <%
           PageUtils pagejsp=(PageUtils) request.getAttribute("page");
            List<StudentClass> listClass= pagejsp.getCurrentList();
            for(StudentClass studentClass:listClass)
            {
        %>
        <tr>
            <td>
                <%=studentClass.getClno()%>
            </td>
            <td>
                <%=studentClass.getClname()%>
            </td>
            <td>
                <%=studentClass.getDno()%>
            </td>
        </tr>
        <%}
        %>
        <c:forEach items="${page.currentList}" var="stuclass">
            <tr><td>${stuclass.clno}</td><td>${stuclass.clname}</td><td>${stuclass.dno}</td></tr>
        </c:forEach>

    </table>
    <a href="${pageContext.request.contextPath }/classList?pageNumb=<%=pagejsp.getPrePageNumb()%>">前一页</a>
   <!-- <a href="/demo01/classList?pageNumb=${page.prePageNumb}">前一页</a>-->
    <%
        Object obj = request.getAttribute("page");
        PageUtils pager = (PageUtils) obj;
        for (int i = 1; i <= pager.getPageCount(); i++) {
    %>
    <a href="${pageContext.request.contextPath }/classList?pageNumb=<%=i%>"><%=i %></a>
    <%
        }
    %>
    <a href="${pageContext.request.contextPath }/classList?pageNumb=${page.nextPageNumb}">后一页</a>
</div>

</body>
</html>
